﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Categories.aspx.vb" Inherits="MyInventory._Categories" %>
<asp:Content ID="HeaderContent" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

<asp:Table id="tblTitle" runat="server" width="100%" BorderWidth="0">
<asp:TableRow>
    <asp:TableCell width="100%" HorizontalAlign="Center" BackColor="#000066"><asp:label id="lblTitle" runat="server" ForeColor="White" Font-Bold="True" Font-Size="Large">Text read from Page_Load</asp:label></asp:TableCell>
</asp:TableRow>
</asp:Table>

<hr />

<asp:Table id="tblDetail" runat="server" width="100%" BorderWidth="0">
<asp:TableRow>
    <asp:TableCell>

        <asp:Table id="tblDetail2" runat="server" width="100%" BorderWidth="0">
        <asp:TableRow>
            <asp:TableCell><asp:button id="btnAddNew" Text="Add New Category" CssClass="Button" Runat="server" CausesValidation="False"></asp:button></asp:TableCell>
            <asp:TableCell HorizontalAlign="Right"><asp:button id="btnRefresh" Text="REFRESH" CssClass="Button" Runat="server" CausesValidation="False"></asp:button></asp:TableCell>
        </asp:TableRow>
        </asp:Table>
    
    </asp:TableCell>
 </asp:TableRow>
 <asp:TableRow>
    <asp:TableCell>
        <asp:Panel id="pnlForm" Visible="False" Runat="server">

	        <asp:Table id="Table1" runat="server" width="100%" BorderWidth="1">
            <asp:TableHeaderRow>
                <asp:TableHeaderCell> </asp:TableHeaderCell>
                <asp:TableHeaderCell> </asp:TableHeaderCell>
                <asp:TableHeaderCell> </asp:TableHeaderCell>
            </asp:TableHeaderRow>
                <asp:TableRow>
			        <asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Category Name:</asp:TableCell>
			        <asp:TableCell CssClass="FormInput">
				        <asp:textbox id="txtCategoryName" runat="server" Columns="42" MaxLength="40" EnableViewState="False"></asp:textbox>&nbsp;
				        <asp:RequiredFieldValidator id="rfvName" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtCategoryName"></asp:RequiredFieldValidator></asp:TableCell>
                        <asp:TableCell ColumnSpan="0" VerticalAlign="Top" RowSpan="4">Featured Image:<br />
                            <asp:Image ID="Image1" runat="server" Width="100" Height="80" ImageUrl="~/Images/button4.png" /><br /><br />
                            <asp:FileUpload ID="FileUpload1" runat="server" /> 
                            <asp:Button id="btnUploadButton" Text="Upload file" runat="server" CausesValidation="False"></asp:Button><br /> 
                            <asp:Label id="UploadStatusLabel" runat="server" Width="50%"></asp:Label>
                            <asp:textbox id="txtImage" runat="server" Columns="160" MaxLength="160" EnableViewState="False" Visible="False"></asp:textbox>
                        </asp:TableCell>
		        </asp:TableRow>
                <asp:TableRow>
			        <asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Short Description:</asp:TableCell>
			        <asp:TableCell CssClass="FormInput">
				        <asp:textbox id="txtShortDesc" runat="server" Columns="80" MaxLength="160" EnableViewState="False"></asp:textbox>&nbsp;
				        <asp:RequiredFieldValidator id="rfvshortdesc" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtShortDesc"></asp:RequiredFieldValidator></asp:TableCell>
 		        </asp:TableRow>
                <asp:TableRow>
			        <asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Full Description:</asp:TableCell>
			        <asp:TableCell CssClass="FormInput">
				        <asp:textbox id="TxtDescription" runat="server" Columns="60" EnableViewState="False" Rows="8" TextMode="MultiLine"></asp:textbox>&nbsp;
				        <asp:RequiredFieldValidator id="rfvdescription" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtDescription"></asp:RequiredFieldValidator></asp:TableCell>
                        <asp:TableCell></asp:TableCell>
		        </asp:TableRow>
		        <asp:TableRow>
			        <asp:TableCell CssClass="FormLabel" width="15%" HorizontalAlign="Right">Parent Category:</asp:TableCell>
			        <asp:TableCell CssClass="FormInput">
				        <asp:textbox id="txtParent" runat="server" Columns="22" MaxLength="22" EnableViewState="False" Text="0"></asp:textbox>&nbsp;
				        <asp:RequiredFieldValidator id="rfvsubof" runat="server" ErrorMessage="Required!" Display="Dynamic" ControlToValidate="txtParent"></asp:RequiredFieldValidator>

                        <asp:DropDownList ID="lstCategories" AutoPostBack="True" OnSelectedIndexChanged="Selection_Change" runat="server"></asp:DropDownList>

                        </asp:TableCell>
                        <asp:TableCell></asp:TableCell>
		        </asp:TableRow>
                <asp:TableRow>
                        <asp:TableCell> </asp:TableCell>
                        <asp:TableCell> </asp:TableCell>
                        <asp:TableCell> </asp:TableCell>
                </asp:TableRow>
		        <asp:TableRow>
                    <asp:TableCell> </asp:TableCell>
        			<asp:TableCell><asp:Button id="btnSave" Text="Save Changes" CssClass="Button" Runat="server"></asp:Button></asp:TableCell>
                    <asp:TableCell> </asp:TableCell>
        		</asp:TableRow>
	        </asp:Table>
        </asp:Panel>
    </asp:TableCell>
</asp:TableRow>
<asp:TableRow>
    <asp:TableCell VerticalAlign="Top" Width="100%">
        <asp:datagrid id="dgCategories" runat="server" AllowPaging="True" AutoGenerateColumns="False" AllowSorting="True" DataKeyField="ID" CellSpacing="2" ShowFooter="False" CellPadding="2" Width="100%">
				<SelectedItemStyle CssClass="DataGrid_SelectedItemStyle" />
				<ItemStyle CssClass="DataGrid_ItemStyle" />
				<AlternatingItemStyle CssClass="DataGrid_AlternatingItemStyle" />
				<HeaderStyle CssClass="DataGrid_HeaderStyle" BackColor="#E4E4E4" />
				<FooterStyle CssClass="DataGrid_FooterStyle" />
				<Columns>
					<asp:BoundColumn DataField="ID" SortExpression="ID" HeaderText="ID" ItemStyle-HorizontalAlign="Right" />
					<asp:BoundColumn DataField="CategoryName" SortExpression="CategoryName" HeaderText="Category Name" ItemStyle-Wrap="False" />
					<asp:BoundColumn DataField="shortdesc" SortExpression="shortdesc" HeaderText="Short Description" />
					<asp:BoundColumn DataField="description" SortExpression="description" HeaderText="Full Description" />
					<asp:BoundColumn DataField="subof" SortExpression="subof" HeaderText="Parent" ItemStyle-HorizontalAlign="Right" />
					<asp:BoundColumn DataField="FeaturedImage" SortExpression="FeaturedImage" HeaderText="Featured Image" Visible="False" />
					<asp:ButtonColumn Text="Edit" ButtonType="PushButton" CommandName="Select" ItemStyle-HorizontalAlign="Center" />
					<asp:ButtonColumn Text="Delete" ButtonType="PushButton" CommandName="Select" ItemStyle-HorizontalAlign="Center" />
				</Columns>
				<PagerStyle CssClass="DataGrid_PagerStyle" Mode="NumericPages"  BackColor="#E4E4E4" />
			</asp:datagrid>
			<input id="htmlHiddenSortExpression" type="hidden" value="CategoryName" name="htmlHiddenSortExpression" runat="server"/>	
        </asp:TableCell>
</asp:TableRow>
</asp:Table>
<br />
<span  class="Message">
<asp:label id="lblMsg" runat="server">MSG: <%= strMsg%></asp:label>
</span><br />
<span class="ErrorMessage">
<asp:label id="lblErrorMsg" runat="server">ERROR: <%= strErrorMsg%></asp:label>
</span>

</asp:Content>
